package Image;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.qrcode.QRCodeWriter;

import javax.imageio.ImageIO;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.01.24.09.26
 */
public class Erwm {
    public static void main(String[] args) throws WriterException, IOException {

            String qr = "c:/qr.png";
//生成QRcode
            var bm = new QRCodeWriter().encode("http://img0.baidu.com/it/u=1119515913,3748293383&fm=26&fmt=auto", BarcodeFormat.QR_CODE, 200, 200);
            var i = MatrixToImageWriter.toBufferedImage(bm);
            ImageIO.write(i, "png", new FileOutputStream(qr));

        }

}
